<template>
    <div class="goods_item" @click="goDetail">
        <div class="goods_content">
            <img :src="travelInfo.pictureUrl" alt="">
            <p class="subtitle">{{travelInfo.description}}</p>
        </div>
        <div class="goods_price" style="display: flex; justify-content: space-between; align-items: center">
            <div class="num">￥{{travelInfo.price}}起</div>
            <div style="color: #f63">vip <span>{{travelInfo.vipDiscount}}折</span></div>
        </div>
    </div>
</template>

<script>
    export default {
      name: 'GoodsItem',
      props: {
        travelInfo: {
          type: Object
        }
      },
      data() {
        return {

        }
      },
      methods: {
        goDetail() {
          let {infoId} = this.travelInfo
          this.$router.push({
            name: 'travelDetail',
            query: {
              infoId: infoId
            }
          })
        }
      }
    }
</script>

<style lang="scss">
    .goods_item {
        width: 220px;
        height: 200px;
        display: flex;
        flex-direction: column;
        cursor: pointer;
        padding: 10px;
        background-color: #fff;
        margin-left: 10px;
        margin-bottom: 10px;
        border-radius: 5px;
        .goods_content {
            flex: 1;
            position: relative;
            img {
                width: 100%;
                height: 107px;
            }
            .subtitle {
                display: -webkit-box;
                height: 36px;
                margin: 10px 0;
                overflow: hidden;
                line-height: 18px;
                color: #333;
                -webkit-line-clamp: 2;
                -webkit-box-orient: vertical;
            }
        }
        .goods_price {
            height: 30px;
            .num {
                color: #f63;
            }
        }
    }
</style>
